☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

schema

Table of contents

Description:

This key defines which Schema CloudCannon should use to populate a file created with a standard add option in the + Add button dropdown.

The value is a string that specifies the key name of a Schema defined in schemas to use as the default content for the new file.

Configuring this key will override add_options.default_content_file.

By default, this key uses the default Schema in the Collection configured in add_options.collection (or the containing collection if collection is not specified), if Schemas are configured for that collection. Otherwise, this key has no default value.

Appears in:
└── collections_config
    └── *
        └── add_options
            └── [*]
                └── Add Option
                    └── schema
Type:
string
Examples:

In this example, we have configured a standard add option for the people Collection that uses the employee Schema to populate new files.

Copied to clipboard
collections_config:
  people:
    add_options:
      - name: Add Staff Member
        schema: employee
        icon: face
        editor: data
    schemas:
      employee:
        path: /.cloudcannon/schemas/employee.yml
{
  "collections_config": {
    "people": {
      "add_options": [
        {
          "name": "Add Staff Member",
          "schema": "employee",
          "icon": "face",
          "editor": "data"
        }
      ],
      "schemas": {
        "employee": {
          "path": "/.cloudcannon/schemas/employee.yml"
        }
      }
    }
  }
}
Open in a new tab